import { datas } from './fields.js'
let that
// 串口监听
export default {
	data() {
		return {
			num: 0,
			lists: [],
			id: 0
		}
	},
	computed: {},
	onShow() {
		that = this
		if (that.id > 0) {
			that.getFetchList(that.id)
		}
	},
	created() {
		that = this
	},
	onReady() {},
	onLoad(options) {
		that = this
		that.id = options.id
		that.getFetchList(options.id)
	},
	methods: {
		changeInfo(item) {
			uni.setStorageSync("deviceInfo", item)
			console.log(item)
			uni.navigateTo({
				url: "/pages/device/details/index"
			})
		},
		getFetchList(id) {
			uni.request({
				// url: '/api/h5/getDeviceListRestitution',
				url: '/api/h5/getDeviceListBorrow',
				method: "POST",
				header: {},
				data: {
					"typeId": id
				},
				success: (res) => {
					that.lists = res.data.data
				},
				fail: (err) => {
					console.error(err);
				}
			});
		}
	}
}